//
//  SQLiteManager.swift
//  Swift_Weibo
//
//  Created by Tim on 2019/9/3.
//  Copyright © 2019 Tim. All rights reserved.
//

import Foundation
import SQLite

class SQLiteManager {
    
    /// 管理对象单例
    static let manager = SQLiteManager()
    private init() {}
    
    /// 数据库对象
    private var db: Connection?
    
    /// 当前操作的表
    private var table: Table?
    
    /// 创建数据库
    ///
    /// - Returns: 创建好的数据库
//    func getDatabase() -> Connection {
//        if db == nil {
//            let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
//            do {
//                db = try Connection("\(path)/db.sqlite3")
//                db?.busyTimeout = 5.0
//            } catch {
//                debugLog("本条打印只在 DEBUG 模式下，标识创建数据库失败")
//            }
//        }
//
//        return db!
//    }
//
//    func getTable(tableName: String) -> Table {
//        table = Table(tableName)
//        try! getDatabase().run(table!.create(temporary: false, ifNotExists: true, withoutRowid: false, block: { (builder) in
//            builder.column(Expression<Any>.Type)
//        }))
//    }
}

